<div class="row">
  <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>
<link rel="stylesheet" href="/css/lightbox.css" media="screen"/>
  <div class="span7" style=""> 
	  <form action="/<*$controller*>/<*$action*>/groupid/<*$groupid*>" method="get" >
            <div class="span3" style="float:left;">
                <select name="schoolid" id="schoolid" style=" float:left;width:300px; margin-top:20px;"> 
                    <option value="">---选择校区---</option> 
                    <*foreach from =$school item=a key=k*>
                    <option value="<*$a.schoolid*>" <*if $schoolid==$k*> selected<*/if*>><*$a.schoolname*></option> 
                    <*/foreach*>
                </select>
            </div>
            <div class="span3" style="float:left; margin-top:21px; padding-left:10px;">
                <button type="submit" class="btn btn-primary btn-small" >查询</button>
            </div>
      </form>
    <*if $schoolid*>  
    <div style="clear:both;">
		<*if $picturelist *>
<form action="/<*$controller*>/choosechecked" method="post"   id="f1">  
                <div style="clear:both; padding-top:30px; "><*$page*></div>
                <div class="span6" style="">
                    <*foreach from=$picturelist item=item key =key*>
                        <div style="position:relative;float:left; padding:5px 5px 0px 0px; margin:0px 8px 8px 0px;">
                        
                        	<span style=" position:absolute; top:0; right:0; z-index:100;">
                            	<a href="javascript:deleteit(<*$item.articlefilesid*>,<*$pagenum*>,<*$groupid*>,<*$schoolid*>)"><img src="/images/close_pic.png" width="18" title="删除图片" ></a>
                            </span>
                                                        
                             <a  href="/<*$controller*>/deleteshowvideo/groupid/<*$groupid*>/schoolid/<*$schoolid*>/articlefilesid/<*$item.articlefilesid*>" title="<a href='<*$item.avatar*>' target='_blank'>点此链接下载</a>"><img src="<*$item.avatar*>.jpg" id="img<*$item.articlefilesid*>" /></a> 
                                                        
                            <p><input type="checkbox" style="float:left;background:none" onclick="checkedov(<*$item.articlefilesid*>)" name="htmlid[]" id="<*$item.articlefilesid*>" value="<*$item.articlefilesid*>" />
                            <span style="float:right;"><*if $item.memberlist eq 0*>全班学生<*else*><*count($item.memberlist)*><*/if*></span></p>
                            
                        </div>
                    <*/foreach*>
				</div>
                <div style="clear:both; padding-top:30px; "><*$page*></div>
                <div class="span6" style="clear:both; padding-top:30px; ">
                    <label class="checkbox"><input type="checkbox"  name="qxhtml" id="qxhtml" style="background:none; " value="1" onclick="xuanhtml();"/>全选/取消选择</label>
                    <p style="margin-top:20px;">
                    <input type="button" class="btn btn-primary" id="del" value="删除" onclick="checkhtml('absolute')" >
                    <input type="button" class="btn btn-primary" id="check" value="恢复" onclick="checkhtml('recover')" ></p>
                </div>
				<input type="hidden" name="pagenum" id="pagenum" value="<*$pagenum*>"/>
				<input type="hidden" name="pid" id="pid" value="<*$groupid*>"/>
				<input type="hidden" name="sid" id="sid" value="<*$schoolid*>"/>
</form>
				<input type="hidden" name="ischecked" id="ischecked" value="0"/>
                    

        <*else*>
        <div style="clear:both; margin-left:30px; padding-top:20px;">暂时没有视频！</div>        
        <*/if*>
    </div> 
    <*else*>
    <div style="clear:both; margin-left:30px; padding-top:20px;">请选择校区！</div>
    <*/if*>   
</div>
</div>
<script src="/js/lightbox-2.6.min.js"></script>

<script type="text/javascript">

function checkhtml(action){
	
	if(action=='recover')	{
		document.getElementById('f1').action='/<*$controller*>/recover';
	}else if(action=='absolute'){
		if(confirm("删除将不能恢复")){
			document.getElementById('f1').action='/<*$controller*>/deleteabsolute';
		}
	}
//	alert(document.getElementById('f1').action);return 0;

	
	var checkboxs=document.getElementsByName("htmlid[]");
	var clength=checkboxs.length;
	var isc=0;
	for (var i=0;i<clength;i++) {
		var e=checkboxs[i].value;
		var es=document.getElementById(e);
		if(es.checked==true){
			isc=1;
		}
	}
	if(isc==0){
		alert('<*$translate.select_html*>');
		return false;
	}
	document.getElementById('f1').submit();
	return true;
}

function checkedov(id){
	var ischecked=document.getElementById("ischecked");
	var ids=document.getElementById(id);
	if(ids.checked==true){
		ischecked.value=1;
	}
}

function xuanhtml() {
	var qxhtml=document.getElementById("qxhtml");
	var checkboxs=document.getElementsByName("htmlid[]");
	var ischecked=document.getElementById("ischecked");
	if(qxhtml.checked==true){
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=true;
		}
		ischecked.value=1;
	}else{
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=false;
		}
		ischecked.value=0;
	}
}



  function deleteit(aid,page,groupid,schoolid)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/picdeleteabs/aid/'+aid+'/page/'+page+'/groupid/'+groupid+'/schoolid/'+schoolid;
  }
} 


function chooseit(adid)
{
   window.location='/<*$controller*>/check/groupid/'+adid;
}

</script> 
